FileSystemPackageStore Class

Class to import information if the information in the PackageItem table in LearningStore refers to files stored in the filesystem.

Namespace: Microsoft.LearningComponents.Storage

Assembly: Microsoft.LearningComponents.Storage.dll

Syntax
C#

public class FileSystemPackageStore : PackageStore

Constructors
Name Description
Ð FileSystemPackageStore

Constructor that creates a FileSystemPackageStore.

Properties
Name Description
Ð LearningStore

Gets the LearningStore associated with this PackageStore. The LearningStore contains the package information. Inherited from PackageStore.

Methods
Name Description
Ð AddPackage

Adds a package to PackageStore. The process of adding a package copies the package into a unique directory the PackageStore base path. Any changes to the original file after the package is added are not reflected in the store.

Ï AddPackageReference

Creates and executes a LearningStoreJob to add a package reference to the PackageStore. Inherited from PackageStore.

Ð DeletePackage

Delete a package that was previously added to the store. Deleted information cannot be recovered.

Ð GetPackageReader (PackageItemIdentifier)

Gets a package reader to read the package from the store.

Ï GetPackageReader (PackageItemIdentifier, string)

Return a PackageReader that can read files from a package that is stored in LearningStore.

Ï RemovePackageReference

Creates and executes a LearningStoreJob that removes the package referenced by packageId from PackageStore. This action is permanent and deleted information cannot be recovered. Inherited from PackageStore.

Ï UpdatePackageLocation

Update the package reference to a new location; Inherited from PackageStore.

Events
Name Description
Ð FileDeletionFailed

Event handler for FileDeletionFailed event.

Remarks

Using this class (as opposed to another PackageStoreclass) is determined by the schema installed into LearningStore. The packages being imported can exist anywhere, as long as there is a PackageReader available to access it. In the case of the core schema, this class is used if the PackageItem.Location column contains information about file path locations of the package files.

In this design, LearningStore contains information that points to a location on the file system. The actual resource files are then stored on the file system. The manifest is *not* stored in the file system, but rather is stored in the database both in a complete form as an xml column, as well as read and imported into a variety of columns in LearningStore. There is no copy of package resource files stored in LearningStore.

One reason for copying the package files to an application-specific location is so that the source package files can exist in any package format. For instance, an application may import a package in zip format (using ZipPackageReader) to LearningStore. When the package is added, it is unzipped and stored in the basePath location.

When the package is added to LearningStore, the files are copied into the basePath location. The manifest information is read and then stored in appropriate tables in LearningStore and the manifest xml is also stored in an xml column in LearningStore. This happens using ImportManifest() method. Any changes to the source files once the package has been added to this PackageStore do not affect the information stored in LearningStore and are not available to be read using this PackageStore.